package com.dfec.water.service.impl;

import com.dfec.component.uid.core.service.UidService;
import com.dfec.framework.mybatis.core.page.PageParam;
import com.dfec.water.dao.YdbDeviceTypeDictDao;
import com.dfec.water.entity.YdbDeviceTypeDictEntity;
import com.dfec.water.service.YdbDeviceTypeDictService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dfec.framework.mybatis.core.page.PageUtils;
import java.util.List;

/**
 * @author df
 * @title: YdbDeviceTypeDictServiceImpl
 * @description: 设备类别维护Service业务层处理
 * @date Thu Feb 06 11:10:12 CST 2025
 */
@Service("ydbDeviceTypeDictService")
@RequiredArgsConstructor
public class YdbDeviceTypeDictServiceImpl extends ServiceImpl<YdbDeviceTypeDictDao, YdbDeviceTypeDictEntity> implements YdbDeviceTypeDictService {

    private final YdbDeviceTypeDictDao ydbDeviceTypeDictDao;

    private final UidService uidService;

    /**
     * 分页查询
     *
     * @param pageParam 入参
     * @return PageUtils
     * @author df
     * @date Thu Feb 06 11:10:12 CST 2025
     */
    @Override
    public PageUtils queryPage(PageParam<YdbDeviceTypeDictEntity> pageParam) {
        return ydbDeviceTypeDictDao.selectPage(pageParam);
    }

    /**
     * 不带分页查询
     *
     * @param ydbDeviceTypeDictEntity 入参
     * @return List<YdbDeviceTypeDictEntity>
     * @author df
     * @date Thu Feb 06 11:10:12 CST 2025
     */
    @Override
    public List<YdbDeviceTypeDictEntity> listAll(YdbDeviceTypeDictEntity ydbDeviceTypeDictEntity) {
        return ydbDeviceTypeDictDao.selectAll(ydbDeviceTypeDictEntity);
    }

    @Override
    public boolean save(YdbDeviceTypeDictEntity entity) {
        entity.setId(uidService.next());
        return super.save(entity);
    }
}